//
//  LZSearchUserTableViewCell.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/13.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "LZSearchUserTableViewCell.h"
#import "FitHeader.h"
#import "Model.h"
#import "UIImageView+WebCache.h"
@implementation LZSearchUserTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
        [self changeColor];
    }
    return self;
}

-(void)changeColor{
    self.backgroundColor = [Model shareInstance].ViewColor;
}


- (void)createView{
    _smallPicImageView = [[UIImageView alloc]init];
    _smallPicImageView.clipsToBounds = YES;
    _smallPicImageView.layer.cornerRadius = 30 * FITWidth;
    [self.contentView addSubview:_smallPicImageView];
    
    _nicknameLabel = [[BaseLabel alloc]init];
    _nicknameLabel.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:_nicknameLabel];
    
    _tracks_countsLabel = [[BaseLabel alloc]init];
    _tracks_countsLabel.font = [UIFont systemFontOfSize:13];
    _tracks_countsLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:_tracks_countsLabel];
    
    _followers_countsLabel = [[BaseLabel alloc]init];
    _followers_countsLabel.textColor = [UIColor lightGrayColor];
    _followers_countsLabel.font = [UIFont systemFontOfSize:13];
    [self.contentView addSubview:_followers_countsLabel];
    
    //    _personDescribeLabel = [[BaseLabel alloc]init];
    //    _personDescribeLabel.backgroundColor = [UIColor redColor];
    //    _personDescribeLabel.textColor = [UIColor redColor];
    //    _personDescribeLabel.font = [UIFont systemFontOfSize:13];
    //    [self.contentView addSubview:_personDescribeLabel];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    _smallPicImageView.frame = CGRectMake(10 * FITWidth, 10 * FITHeight, 60 * FITWidth, 60 * FITHeight);
    _nicknameLabel.frame = CGRectMake(_smallPicImageView.frame.origin.x + _smallPicImageView.frame.size.width + 10 * FITWidth, _smallPicImageView.frame.origin.y, 220 * FITWidth, 30 * FITHeight);
    _tracks_countsLabel.frame = CGRectMake(_nicknameLabel.frame.origin.x, _nicknameLabel.frame.origin.y + _nicknameLabel.frame.size.height + 10 * FITHeight, 80 * FITWidth, 20 * FITHeight);
    _followers_countsLabel.frame = CGRectMake(_tracks_countsLabel.frame.origin.x + _tracks_countsLabel.frame.size.width, _tracks_countsLabel.frame.origin.y, _tracks_countsLabel.frame.size.width, _tracks_countsLabel.frame.size.height);
    //    _personDescribeLabel.frame = CGRectMake(_tracks_countsLabel.frame.origin.x, _tracks_countsLabel.frame.origin.y + _tracks_countsLabel.frame.size.height + 10 * FITHeight, _nicknameLabel.frame.size.width, _tracks_countsLabel.frame.size.height);
}
- (void)setLzSearchAlbum:(LZSearchAlbum *)lzSearchAlbum{
    if (_lzSearchAlbum != lzSearchAlbum) {
        _lzSearchAlbum = lzSearchAlbum;
    }
    [_smallPicImageView sd_setImageWithURL:[NSURL URLWithString:lzSearchAlbum.smallPic] placeholderImage:[UIImage imageNamed:@"100*100"]];
    _nicknameLabel.text = lzSearchAlbum.nickname;
    _tracks_countsLabel.text = [NSString stringWithFormat:@"声音 %@", lzSearchAlbum.tracks_counts];
    _followers_countsLabel.text = [NSString stringWithFormat:@"粉丝 %@", lzSearchAlbum.followers_counts];
    [self changeColor];
}
@end
